﻿using Microsoft.AspNetCore.Http;
using System.Net;

namespace LDM.Framework.ExceptionHandling;

/// <summary>
/// 业务异常
/// </summary>
public class BusinessException : Exception
{
    /// <summary>
    /// 错误码
    /// </summary>
    public int Code { get; set; }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="code"></param>
    /// <param name="message"></param>
    /// <param name="innerException"></param>
    public BusinessException(int code, string message, Exception innerException = default)
        : base(message, innerException)
    {
        Code = code;
       
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="message"></param>
    /// <param name="innerException"></param>
    public BusinessException(string message, Exception innerException = default)
        : this(StatusCodes.Status400BadRequest, message, innerException)
    {
        
    }
}
